#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    QPushButton *btnServer = new QPushButton("服务端");
    QPushButton *btnClient = new QPushButton("客户端");
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(btnServer);
    layout->addWidget(btnClient);
    setLayout(layout);
    setMinimumWidth(260);

    connect(btnServer, &QPushButton::clicked, [] {
        Server *server = new Server;
        server->setAttribute(Qt::WA_DeleteOnClose);
        server->show();
    });
    connect(btnClient, &QPushButton::clicked, [] {
        Client *client = new Client;
        client->setAttribute(Qt::WA_DeleteOnClose);
        client->show();
    });
}

Widget::~Widget()
{
}

